home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / tools / dev_libs / feelin040718 / demos / rgb.e < prev    next >
Text File  |  2004-08-03  |  5KB  |  158 lines

  1. OPT PREPROCESS
  2.  
  3. MODULE 'feelin','libraries/feelin','a4',
  4.        'intuition/intuition',
  5.        'graphics/rastport','graphics/gfxmacros',
  6.        'utility/hooks'
  7.  
  8. DEF feelinbase:PTR TO feelinbase
  9.  
  10. PROC main()
  11.    DEF app,win,myback[16]:STRING,hook:hook
  12.    DEF grp,o1,o2
  13.  
  14.    sys_SGlob()
  15.  
  16.    hook.entry := {hook_draw}
  17.    hook.data  := NIL
  18.  
  19.    StringF(myback,'H:%08lx',hook)
  20.  
  21.    IF feelinbase := OpenLibrary('feelin.library',FV_VERSION)
  22.       app := AppObject,
  23.          FA_Application_Title,        'Demo00',
  24.          FA_Application_Version,      '$VER: Demo00 04.00 (04/01/2003)',
  25.          FA_Application_Copyright,    '©2000 - 2003, Olivier LAVIALE',
  26.          FA_Application_Author,       'Olivier LAVIALE <HaploLaMain@aol.com>',
  27.          FA_Application_Description,  'Testing...',
  28.          FA_Application_Base,         'DEMO00',
  29.  
  30.          Child, win := WindowObject,
  31.             FA_ID,            "MAIN",
  32.             FA_Back,          myback,
  33.             FA_Window_Title,  'Test',
  34.             FA_ContextHelp,   '<align=center><b>Three colored buttons</b></align><hr shine=fill shadow=shadow><align=justify>It is possible for <u>each</u> gadget<br>to have its very own <pens shadow=fill>color scheme</pens>.<br>All you have to do is define<br>the <pens shadow=fill>FA_ColorScheme</pens> attribute.',
  35.             FA_Window_Open,   TRUE,
  36. /*
  37. ->            FA_Window_Borderless,   TRUE,
  38. ->            FA_Window_CloseGadget,  FALSE,
  39. ->            FA_Window_IconifyGadget, FALSE,
  40. */
  41.             Child, grp := HGroup, FA_Font,'Garnet/16', FA_ColorScheme,',,,c:FFFFFF',
  42.                Child, o1 := TextObject, ButtonFrame, TextBack, FA_ColorScheme,'c:FF0000,c:C00000,c:000000', FA_Text,'R_ed',   InputRelease, FA_ContextHelp,'<font face=garnet size=16 color=#FF0000><pens shadow=halfdark>Red color</pens></font>',   End,
  43.                Child, TextObject, ButtonFrame, TextBack, FA_ColorScheme,'c:0000FF,c:0000C0,c:000000', FA_Text,'B_lue',  InputRelease, FA_ContextHelp,'<font face=garnet size=16 color=#0000FF><pens shadow=halfdark>Blue color</pens></font>',  End,
  44.             End,
  45.          End,
  46.       End
  47.  
  48.       IF app
  49.          F_DoA(grp,FM_AddMember,[TextObject,
  50.                                  ButtonFrame,
  51.                                  TextBack,
  52.                                  FA_ColorScheme,'c:00FF00,c:00C000,c:000000',
  53.                                  FA_Text,'G_reen',
  54.                                  InputRelease,
  55.                                  FA_ContextHelp,'<font face=garnet size=16 color=#00FF00><pens shadow=halfdark>Green color</pens></font>',
  56.                                  End,
  57.  
  58.                                  FV_AddMember_Insert,o1])
  59.  
  60.          F_DoA(win,FM_Notify,[FA_Window_CloseRequest,TRUE, app, FM_Application_Shutdown,0])
  61.  
  62. /*
  63.          F_DoA(w,FM_Notify,[FA_Window_Active,TRUE,  FV_Notify_Self,
  64.                             FM_Set,4,FA_Window_Title,t1,FA_NoNotify,TRUE])
  65.          F_DoA(w,FM_Notify,[FA_Window_Active,FALSE, FV_Notify_Self,
  66.                             FM_Set,4,FA_Window_Title,t2,FA_NoNotify,TRUE])
  67. */
  68.          F_DoA(app,FM_Application_Run,NIL)
  69.  
  70.          F_DisposeObj(app)
  71.       ELSE
  72.          PrintF('Unable to create application\n')
  73.       ENDIF
  74.  
  75.       CloseLibrary(feelinbase)
  76.    ENDIF
  77. ENDPROC
  78.  
  79. PROC hook_draw(msg=A1:PTR TO FS_ImageDisplay_HookDraw)
  80.    DEF x1,y1,x2,y2,x3,
  81.        rp:PTR TO rastport,pt,ap,bp
  82.  
  83.    sys_RGlob()
  84.  
  85.    pt := [%1111111100000000,
  86.           %0111111110000000,
  87.           %0011111111000000,
  88.           %0001111111100000,
  89.           %0000111111110000,
  90.           %0000011111111000,
  91.           %0000001111111100,
  92.           %0000000111111110,
  93.           %0000000011111111,
  94.           %1000000001111111,
  95.           %1100000000111111,
  96.           %1110000000011111,
  97.           %1111000000001111,
  98.           %1111100000000111,
  99.           %1111110000000011,
  100.           %1111111000000001]:INT
  101.  
  102.    pt := [%1000100010001000,
  103.           %0100010001000100,
  104.           %0010001000100010,
  105.           %0001000100010001]:INT
  106. /*
  107.           %1000100010001000,
  108.           %0100010001000100,
  109.           %0010001000100010,
  110.           %0001000100010001,
  111.           %1000100010001000,
  112.           %0100010001000100,
  113.           %0010001000100010,
  114.           %0001000100010001,
  115.           %1000100010001000,
  116.           %0100010001000100,
  117.           %0010001000100010,
  118.           %0001000100010001]:INT*/
  119.  
  120. /*
  121.    pt := [%1111111100000000,
  122.           %0111111110000000,
  123.           %0011111111000000,
  124.           %0001111111100000,
  125.           %0000111111110000,
  126.           %0000011111111000,
  127.           %0000001111111100,
  128.           %0000000111111110,
  129.           %0000000011111111,
  130.           %0000000111111110,
  131.           %0000001111111100,
  132.           %0000011111111000,
  133.           %0000111111110000,
  134.           %0001111111100000,
  135.           %0011111111000000,
  136.           %0111111110000000]:INT
  137. */
  138.    x1 := msg.region.x1 ; x3 := msg.region.x2 ; x2 := x3 - x1 / 3 + x1
  139.    y1 := msg.region.y1 ; y2 := msg.region.y2 ; rp := msg.render.rport
  140.  
  141.    ap := msg.render.palette.pens[FV_Pen_Fill]
  142.    bp := msg.render.palette.pens[FV_Pen_HalfShadow]
  143.  
  144.    _APen(bp)
  145.    _Boxf(x1,y1,x2,y2)
  146.  
  147.    rp.areaptrn := pt
  148.    rp.areaptsz := 2
  149.  
  150.    _APen(ap)
  151.    _BPen(bp)
  152.    _Boxf(x2+1,y1,x3,y2)
  153.  
  154.    rp.areaptsz := 0
  155.    rp.areaptrn := NIL
  156. ENDPROC
  157.  
  158.